<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>高级登录注册页面</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Arial', sans-serif;
            height: 100vh;
            overflow: hidden;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            position: relative;
        }

        /* 动态背景粒子 */
        .particles {
            position: absolute;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        .particle {
            position: absolute;
            width: 4px;
            height: 4px;
            background: rgba(255, 255, 255, 0.5);
            border-radius: 50%;
            animation: float 15s infinite linear;
        }

        @keyframes float {
            0% {
                transform: translateY(100vh) translateX(0);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateY(-100vh) translateX(100px);
                opacity: 0;
            }
        }

        /* 主容器 */
        .container {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 400px;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
            border: 1px solid rgba(255, 255, 255, 0.18);
            padding: 40px;
            transition: all 0.3s ease;
        }

        /* 标题 */
        .title {
            text-align: center;
            color: white;
            font-size: 32px;
            margin-bottom: 30px;
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
        }

        /* 表单组 */
        .form-group {
            margin-bottom: 20px;
            position: relative;
        }

        .form-group label {
            display: block;
            color: rgba(255, 255, 255, 0.8);
            margin-bottom: 8px;
            font-size: 14px;
        }

        .form-group input {
            width: 100%;
            padding: 12px 15px;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 8px;
            color: white;
            font-size: 16px;
            transition: all 0.3s ease;
        }

        .form-group input::placeholder {
            color: rgba(255, 255, 255, 0.5);
        }

        .form-group input:focus {
            outline: none;
            border-color: rgba(255, 255, 255, 0.8);
            background: rgba(255, 255, 255, 0.15);
            box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
        }

        /* 按钮 */
        .btn {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

        .btn:active {
            transform: translateY(0);
        }

        /* 切换链接 */
        .switch-link {
            text-align: center;
            margin-top: 20px;
            color: rgba(255, 255, 255, 0.8);
        }

        .switch-link a {
            color: white;
            text-decoration: none;
            font-weight: bold;
            transition: all 0.3s ease;
        }

        .switch-link a:hover {
            text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
        }

        /* 注册表单 */
        .register-form {
            display: none;
        }

        /* 错误提示 */
        .error-message {
            color: #ff6b6b;
            font-size: 14px;
            margin-top: 5px;
            display: none;
        }

        /* 成功提示 */
        .success-message {
            color: #51cf66;
            font-size: 14px;
            margin-top: 5px;
            display: none;
        }

        /* 加载动画 */
        .loading {
            display: none;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 40px;
            height: 40px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to { transform: translate(-50%, -50%) rotate(360deg); }
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .container {
                width: 90%;
                padding: 30px 20px;
            }
        }
    </style>
</head>
<body>
<!-- 动态背景粒子 -->
<div class="particles" id="particles"></div>

<!-- 主容器 -->
<div class="container">
    <!-- 登录表单 -->
    <div class="login-form" id="loginForm">
        <h2 class="title">用户登录</h2>
        <form id="loginFormElement">
            <div class="form-group">
                <label for="loginUsername">用户名</label>
                <input type="text" id="loginUsername" name="username" required placeholder="请输入用户名">
                <div class="error-message" id="loginUsernameError"></div>
            </div>
            <div class="form-group">
                <label for="loginPassword">密码</label>
                <input type="password" id="loginPassword" name="password" required placeholder="请输入密码">
                <div class="error-message" id="loginPasswordError"></div>
            </div>
            <button type="submit" class="btn">登录</button>
            <div class="success-message" id="loginSuccess"></div>
        </form>
        <div class="switch-link">
            还没有账号？<a href="#" onclick="switchForm('register')">立即注册</a>
        </div>
    </div>

    <!-- 注册表单 -->
    <div class="register-form" id="registerForm">
        <h2 class="title">用户注册</h2>
        <form id="registerFormElement">
            <div class="form-group">
                <label for="regUsername">用户名</label>
                <input type="text" id="regUsername" name="username" required placeholder="请输入用户名">
                <div class="error-message" id="regUsernameError"></div>
            </div>
            <div class="form-group">
                <label for="regPassword">密码</label>
                <input type="password" id="regPassword" name="password" required placeholder="请输入密码">
                <div class="error-message" id="regPasswordError"></div>
            </div>
            <div class="form-group">
                <label for="regEmail">邮箱</label>
                <input type="email" id="regEmail" name="email" required placeholder="请输入邮箱">
                <div class="error-message" id="regEmailError"></div>
            </div>
            <div class="form-group">
                <label for="regPhone">手机号</label>
                <input type="tel" id="regPhone" name="phone" required placeholder="请输入手机号">
                <div class="error-message" id="regPhoneError"></div>
            </div>
            <button type="submit" class="btn">注册</button>
            <div class="success-message" id="regSuccess"></div>
        </form>
        <div class="switch-link">
            已有账号？<a href="#" onclick="switchForm('login')">立即登录</a>
        </div>
    </div>

    <!-- 加载动画 -->